package cn.eclass.utils;

import java.util.Date;

import cn.eclass.bean.api.IGiftBean;
import cn.eclass.entity.GiftEntity;
import cn.eclass.entity.GiftOrderEntity;

//This class is almost the same as GiftOrderEntity, but it combines the information from GiftEntity.
public class GiftOrderObject {

    private int giftId;

    private long ordertime;
    private String description;//This column is used for phone card number or something else.
    
    private String picture;
    private int points;
    private String name;
    
    IGiftBean bean = BeanFactory.factory.getGiftBean();
    private GiftOrderEntity goe = null;
    
    public GiftOrderObject(GiftOrderEntity goeEntity) {
    	giftId = goeEntity.getGiftId();
    	ordertime = goeEntity.getOrdertime();
    	description = goeEntity.getDescription();
    	GiftEntity ge = bean.get(giftId);
    	picture = ge.getPicture();
    	points = ge.getPoints();
    	name = ge.getName();
    	
    	goe = goeEntity;
    }
    
	public int getGiftId() {
		return giftId;
	}
	public void setGiftId(int giftId) {
		this.giftId = giftId;
	}
	public String getOrdertime() {
		Date d = new Date(ordertime);
		return d.toString();
	}

	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public String getPicture() {
		return picture;
	}
	public void setPicture(String picture) {
		this.picture = picture;
	}
	public int getPoints() {
		return points;
	}
	public void setPoints(int points) {
		this.points = points;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getStatus(){
		if(goe.getValid() == 1) return("卡密已生成");
		return("卡密未生成");
	}
	public int getValid(){
		return goe.getValid();
	}
    
    
}
